﻿using OnWork.DataCenter.DAL.Common;
using SqlSugar;

namespace OnWork.DataCenter.DAL.DataCenter
{
    /// <summary>
    /// 数据源 MQTT
    /// </summary>
    public class DSMqtt : BaseEntity
    {
        /// <summary>
        /// 数据连接名称
        /// </summary>
        public string Name { get; set; }

        /// <summary>
        /// 服务Ip代理地址
        /// </summary>
        public string BrokerAddress { get; set; }

        /// <summary>
        /// 服务Ip代理端口号
        /// </summary>
        public int BrokerPort { get; set; }

        /// <summary>
        /// 客户端ID
        /// </summary>
        public string ClientID { get; set; }

        /// <summary>
        /// 用户名
        /// </summary>
        [SugarColumn(IsNullable = true)]
        public string UserName { get; set; }

        /// <summary>
        /// 密码
        /// </summary>
        [SugarColumn(IsNullable = true)]
        public string? Password { get; set; }

        /// <summary>
        /// 关联MQTT配置里的 主题
        /// </summary>
        [Navigate(NavigateType.OneToMany, nameof(DSMqttTopic.MqttID))]
        public List<DSMqttTopic> Topics { get; set; } //不能赋值只能是null
    }
}